#ifndef ACDB_H
#define ACDB_H

#include <QtSql>
#include <QGridLayout>

class AcDB
{
public:
    AcDB();
    ~AcDB();

    bool open();

    bool getFixedItemList(QLayout* layout);
    bool getMonthSalary(QDate date, QList<float>* result);
    bool getMonthBrief(QDate date, QList<float>* result);
    bool getDayBrief(QDate date, QList<float>* result);
    bool getDayDataset(QDate date, QAbstractItemModel* model);

    bool listClass(QList< QList<QVariant> >* result);

    bool addItem(const QList<QVariant>* data);
    bool updateItem(int id, const QList<QVariant>* data);
    bool getItem(int id, QList<QVariant>* result);
    bool delItem(int id);

    bool updateSalary(QDate* date, float cost, int type);

private:
    QSqlDatabase m_db;
};

#endif // ACDB_H
